{% extends "users/auth/base.html" %}
{% load static %}

{% block "scripts" %}
	<script src="{% static "js/registration.js" %}" defer></script>
{% endblock %}

{% block "login-content" %}

	<form id="register" class="animate__animated animate__fadeInUp animate__fast d-flex flex-grow flex-column text-dark bg-light rounded-3 shadow-lg p-4 m-4 needs-validation" method="post" action="{% url 'users:register' %}" style="min-width: 550px; max-width: 30%;" novalidate>
		
		{% csrf_token %}
		
		<!-- Title -->
		<h3 class="mb-4 fw-bold">Register</h3>

		<!-- Course Code -->
		<div class="mb-3">
			<label for="id_course_code" class="form-label fw-bold">Course Code: </label>
			<input type="text" name="course_code" class="form-control bg-light border-dark border-2{% if form.errors.course_code %} is-invalid{% endif %}" id="id_course_code" maxlength="150" placeholder="e.g. CS123XYZ" {% if form.course_code.value %}value="{{ form.course_code.value }}"{% endif %} required>
			<div id="course_invalid" class="invalid-feedback">
			{% if form.errors.course_code %}
			{{ form.errors.course_code}}
			{% endif %}
			</div>
		</div>

		<!-- Email Address -->
		<div class="mb-3">
			<label for="id_email" class="form-label fw-bold">Primary Email Address: </label>
			<input type="email" name="primary_email_address" class="form-control bg-light border-dark border-2{% if form.errors.primary_email_address %} is-invalid{% endif %}" id="id_email" placeholder="e.g. cs123xyz@gmail.com" {% if form.primary_email_address.value %}value="{{ form.primary_email_address.value }}"{% endif %} required>
			<div id="email_invalid" class="invalid-feedback">
				{% if form.errors.primary_email_address %}
				{{ form.errors.primary_email_address }}
				{% endif %}
			</div>
		</div>

		<!-- MOSS ID -->
		<div class="mb-3">
			<label for="id_moss_id" class="form-label fw-bold">MOSS ID: </label>
			<input type="text" name="moss_id" class="form-control bg-light border-dark border-2{% if form.errors.moss_id %} is-invalid{% endif %}" id="id_moss_id" maxlength="32" placeholder="e.g. 123456789" {% if form.moss_id.value %}value="{{ form.moss_id.value }}"{% endif %} required>
			<div id="moss_id_invalid" class="invalid-feedback">
				{% if form.errors.moss_id %}
				{{ form.errors.moss_id }}
				{% endif %}
			</div>
		</div>

		<!-- Password -->
		<div class="mb-3">
			<label for="id_password1" class="form-label fw-bold">Password: </label>
			<input type="password" name="password1" class="form-control bg-light border-dark border-2{% if form.errors.password1 %} is-invalid{% endif %}" id="id_password1" placeholder="Enter a password" required>
			<div id="password_1_invalid" class="invalid-feedback">
				{% if form.errors.password1 %}
				{{ form.errors.password1 }}
				{% endif %}
			</div>
		</div>

		<!-- Password Confirmation -->
		<div class="mb-3">
			<label for="id_password2" class="form-label fw-bold">Confirm Password: </label>
			<input type="password" name="password2" class="form-control bg-light border-dark border-2{% if form.errors.password2 %} is-invalid{% endif %}" id="id_password2" placeholder="Confirm your password" required>
			<div id="password_2_invalid" class="invalid-feedback">
				{% if form.errors.password2 %}
				{{ form.errors.password2 }}
				{% endif %}
			</div>
		</div>

		<!-- Submit -->
		<div class="mb-3">
			<button type="submit" class="btn btn-primary rounded-pill text-light mt-3">
				<svg class="pb-1 me-1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-pencil-square" viewBox="0 0 16 16">
					<path d="M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z"/>
					<path fill-rule="evenodd" d="M1 13.5A1.5 1.5 0 0 0 2.5 15h11a1.5 1.5 0 0 0 1.5-1.5v-6a.5.5 0 0 0-1 0v6a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5H9a.5.5 0 0 0 0-1H2.5A1.5 1.5 0 0 0 1 2.5v11z"/>
				</svg>
				Register
			</button>
		</div>

		<!-- Already Have An Account -->
		<div class="mb-3">
			Already have an account? <a href="javascript:void(goTo('{% url 'users:login' %}'));" style="text-decoration: none">Login.</a>
		</div>
		
	</form>

{% endblock %}